package com.fable.dynamicDataSource.service.impl;

import com.fable.dynamicDataSource.dao.UserDao;
import com.fable.dynamicDataSource.domain.User;
import com.fable.dynamicDataSource.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2016/12/5 0005.
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;

    public List<User> findUsersByDefaultDatasourcce() {
        return userDao.findAll();
    }

    public List<User> findUsersByDatasourcce1() {
        //		DynamicDataSourceContextHolder.setDataSource("ds1");
        return userDao.findAll();
    }

    public List<User> findUsersByDatasourcce2() {
        //		DynamicDataSourceContextHolder.setDataSource("ds2");
        return userDao.findAll();
    }

}
